﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RabbitMQ.Client;
using RabbitMQ.Client.Events;

namespace HYService.RabbitMQ
{
    public static class IModelExt
    {
        public static void Requeue(this IModel channel, BasicDeliverEventArgs e)
        {
            try
            {
                channel.BasicPublish(e.Exchange, e.RoutingKey, e.BasicProperties, e.Body);
            }
            catch
            {

            }
        }

        public static void Ack(this IModel channel, BasicDeliverEventArgs e, bool multiple = false)
        {
            try
            {
                channel.BasicAck(e.DeliveryTag, multiple);
            }
            catch
            {

            }
        }
    }
}
